<?php

$filename='base64.dat';
$fh = fopen ( $filename, "r" );
if ( !$fh ) {
	die ( "fail to open $filename." );
}

$records_count = 0;
$time_start = time();
while ( !feof($fh) ) {
	$line = fgets($fh);
	$line = trim($line);
	if ( strlen($line) < 1 ) {
		continue;
	}

	$kvs = explode ( "\t", $line );
	$key = $kvs[0];
	$value = gzuncompress( base64_decode( $kvs[1] ) );
	if ( 0 != strcmp($key, $value) ) {
		echo "key:$key\tvalue:$value\n";
	}

	++$records_count;
}
$time_stop = time();
$time_last = $time_stop - $time_start;

$tps = $records_count / $time_last;

echo "recods_count={$records_count} time_last={$time_last} tps={$tps}\n";

fclose ( $fh );

?>
